package model;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class Text {

	private Image img;
	int wid,hei;
	public Text()
	{
		try {
			img=Image.createImage("/text.png");
			wid=(int)(img.getWidth()/42);
			hei=30;
		}
		catch(Exception e)
		{
			System.out.println("Khong tao anh duoc");
			
		}
	}
	public void drawChar(Graphics g,char c,int x,int y)
	{
		if (c>=97 && c<=122)
		{
			int kc=c-'a';
			g.drawRegion(img,25*kc,0, 25, 30,0,x,y, Graphics.TOP|Graphics.LEFT);
		}
		
	}
	public void drawString(String str,int x,int y,Graphics g)
	{
		char []arr=str.toCharArray();
		int len=arr.length;
		for (int i=0;i<len;i++)
		{
			drawChar(g,arr[i],x+i*22, y);
		}
	}
}
